<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<script type="text/javascript">


function Validate() {
    var radios =new Array();
	radios= document.getElementsByName('n')

    for (var i = 0; i <radios.length ; i++) {
        if (radios[i].checked) {
        alert("Selected Value = " + radios[i].value);
        alert(document.f.n);
        return true; // checked
    }}
    return false;
    }
    
    
</script>

</head>
<body>

<form name="f" action="">
<pre>
il radio button mochkla fil validation mta3ou 
lazimna na5dhou tt les element de meme nom , w nparkouriwhom , wnchoufou anahowa li checked
ntastiw exp :

function Validate() {
    var radios = document.getElementsByName('n')

    for (var i = 0; i < radios.length; i++) {
        if (radios[i].checked) {
        alert("Selected Value = " + radios[i].value);
        return true; // checked
    }
    }}</pre>

<input name="n"  type="radio" value="val1" onClick="Validate()"/> value1 <br/>
<input name="n"  type="radio" value="val2" onClick="Validate()"/> value2 <br/>
</form>
</body>
</html>